<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<title></title>
<!--    <link href="assets/css/icons.css" rel="stylesheet"> -->
<!-- <link href="assets/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="assets/css/style.css" rel="stylesheet">
<!--     <link href="assets/css/responsive.css" rel="stylesheet"> -->

</head>

<body>

	<form id="hireForm">
		<h2 class="header-title text-center" id="title">添加系统账号信息</h2>
<!-- 		<div class="form-group"> -->
<!-- 			<input id="id" name="id" type="text" class="form-control" -->
<!-- 				placeholder="账号ID"> -->
<!-- 		</div> -->
		<div class="form-group">
			<input id="name" name="name" type="text" class="form-control"
				placeholder="账号名称">
		</div>
		<div class="form-group">
			<input id="pwd" name="pwd" type="text" class="form-control" placeholder="账号密码">
		</div>
		<div class="form-group">
			<input id="empId" name="empId" type="text" class="form-control" placeholder="员工ID">
		</div>
		<div class="form-group">
			<input id="type" name="type" type="text" class="form-control" placeholder="账号类型">
		</div>
		<div class="form-group">
			<input id="realName" name="realName" type="text" class="form-control" placeholder="真实姓名">
		</div>
		<div class="form-group">
			<input type="button" id="confirmHire" value="确定"
				class="btn btn-primary btn-block"> 
			<input type="button"
				id="returnDept" value="返回" class="btn btn-primary btn-block">
		</div>
	</form>

	<script>
		$(function(){
			//确认按钮
			$("#confirmHire").click(function(){
				//数据校验
				checkDeptData();
				//启动校验
				$('#hireForm').bootstrapValidator('validate');
				
				if(!$('#hireForm').data('bootstrapValidator').isValid()){
					return;
				}
				//添加新的部门
				$.ajax({
					type : "get",
					url : "/HMS/addUserInfo",
					dataType : 'json',
					data:{
						"id":recrId,
						"name":$("#name").val(),
						"pwd":$("#pwd").val(),
						"empId":$("#empId").val(),
						"type":$("#type").val(),
						"realName":$("#realName").val()},
					contentType : "application/json;charset=UTF-8",
					success : function(value) {
						if(value.success == "OK"){
// 							addTable();
							alert("新增账号成功");
							
						}else{
							//登陆失败
							alert(value.msg);
						}
					},
					error : function(data) {
						alert("网络异常，请稍后重试");
					}
				});
			});
			//返回按钮
			$("#returnDept").click(function(){
				initRecr();
			});
			
			
		});
		
		function checkDeptData(){
			$('#hireForm').bootstrapValidator({
			　     message: '输入值错误，请重新输入',
			   feedbackIcons:{
				   validating : 'glyphicon glyphicon-refresh'
			   },
			   fields: {
			       name : {
			          message: '用户名验证失败',
			          validators: {
			               notEmpty: {
			                     message: '用户名不能为空'
			               }
			          }
			       },
			       pwd : {
				          message: '密码验证失败',
				          validators: {
				               notEmpty: {
				                     message: '密码不能为空'
				               }
				          }
				   },
				   realName : {
				          message: '真实姓名验证失败',
				          validators: {
				               notEmpty: {
				                     message: '真实姓名不能为空'
				               }
				          }
				   }
			       
			   
			    }
		    });
		}
	</script>
</body>

</html>
